<?php
// +-------------------------------------------------------------------
// |
// +-------------------------------------------------------------------
// | Copyright (c) 2009-2016 All rights reserved.
// +-------------------------------------------------------------------
namespace Service\User;

class EyesArticle extends \Service\Common\BaseModel
{
    protected $name = 'eyes_article';


    //积分列表
    public function articleList($typeid,$page_num = 1, $page_size = 5,$type = 0)
    {
        $where = [
            'typeid' => $typeid,
            'status' => 1,
            'ifindex' => ['egt',$type],
        ];
        $list = (array)$this->where($where)->order('level desc')->page($page_num, $page_size)->select();
        foreach ($list as &$row) {
            $row['picture'] = get_cover($row['picture'], 'url');
        }
        $count = $this->where($where)->count();
        return [
            $list,
            $page_count = $count,
            $page_total = ceil($count / $page_size),
        ];
    }


}